cmake_minimum_required ( VERSION 3.15 )
project ( MessageProject )

# 动态库配置
add_library ( message SHARED
    Message.hpp
    Message.cpp
)
target_compile_definitions ( message PRIVATE MESSAGE_EXPORTS ) # 定义导出宏
set_target_properties ( message PROPERTIES
    WINDOWS_EXPORT_ALL_SYMBOLS OFF # 禁用自动符号导出
    CXX_VISIBILITY_PRESET hidden # 增强符号控制
)

# 可执行文件配置
add_executable ( hello-world hello-world.cpp )
target_link_libraries ( hello-world PRIVATE message ) # 确保链接顺序